//
//  HomeViewController.m
//  快医项目
//
//  Created by Li Ming on 2016/12/20.
//  Copyright © 2016年 xueye. All rights reserved.
//

#import "HomeViewController.h"
#import "WeatherView.h"
#import <Masonry.h>
#import "ZFBCycleImageView.h"
#import "HomeClassesView.h"
#import "WeatherDetailTableViewController.h"

@interface HomeViewController ()

@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupUI];
    
    [self getButton];
    // Do any additional setup after loading the view.
}

-(void)setupUI{
    
    //建立界面
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    //放置天气VIew
    WeatherView *weatherView = [WeatherView weatherView];
    
    //weatherView.frame = CGRectMake(0, 60, [UIScreen mainScreen].bounds.size.width, 80);
    
    [self.view addSubview:weatherView];
    
    [weatherView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.mas_topLayoutGuideBottom);
        make.left.right.mas_equalTo(self.view);
        make.height.mas_equalTo(self.view.mas_width).multipliedBy(0.3);
        
    }];
    
    //放置轮播器View
    ZFBCycleImageView *cycleImageView = [ZFBCycleImageView new];
    
    [self.view addSubview:cycleImageView];
    
    [cycleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(weatherView.mas_bottom);
        make.left.right.equalTo(self.view);
        make.height.mas_equalTo(self.view.mas_width).multipliedBy(0.7);
        
    }];
    
    //放置6宫格collectionView
    HomeClassesView *collecView = [HomeClassesView new];
    
    [self.view addSubview:collecView];
    
    [collecView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(cycleImageView.mas_bottom);
        make.left.right.bottom.mas_equalTo(self.view);
        
    }];
    
    [weatherView sendButtonWithBlock:^(UIButton *button) {
        
        [button addTarget:self action:@selector(choseCity:) forControlEvents:UIControlEventTouchUpInside];
        
    }];
    
}

-(void)choseCity:(UIButton *)button{
    
    WeatherDetailTableViewController *choseCity = [WeatherDetailTableViewController new];
    
    [self.navigationController pushViewController:choseCity animated:YES];
    
    NSLog(@"------");
    
    
}

-(void)getButton{
    
    
    
}


@end
